package com.owen.controller;

import com.owen.service.PhoneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletResponse;

@Controller
public class ExcelController {

    @Autowired
    private PhoneService phoneService;

    /**
     * 利用freemarker导出excel文件
     * @param response
     */
    @RequestMapping(value = "/excelXMLExport", produces = "application/vnd.ms-excel", method = {RequestMethod.POST, RequestMethod.GET})
    public void excelXMLExport(HttpServletResponse response) {
        phoneService.excelXMLExport(response);
    }



    /**
     * 利用hutool POI方式导出excel文件
     * @param response
     */
    @RequestMapping(value = "/excelXlsxExport", produces = "application/vnd.ms-excel", method = {RequestMethod.POST, RequestMethod.GET})
    public void excelXlsxExport(HttpServletResponse response) {
        phoneService.excelXlsxExport(response);
    }


}
